<div class="row">
 <small>
 <div class="span3 bs-docs-sidebar ">
 	<*include file="<*$controller*>/location.tpl"*>
  </div>
    
  <div class="span6">
    <h3>增加反馈信息</h3>
   
     <div class="control-group">
      <form action="/<*$controller*>/add" method="get"   name="form1" class="form-horizontal">       
		 <select id="jigou" name="groups"  onchange="getSchool(this.value)"></select>
          <select id="school" name="school"  onchange="getClass(this.value)"></select> 
         <select id="class1" name="class" ></select>  
          <input  type="text" id="cnname" name="cnname" value="<*$cnname*>"  class="span2" ></input> 
         <input type="submit" class="btn btn-success"  value="查询"  > 
      </form>
      </div> 
      <form  action="/<*$controller*>/addop" method="post" enctype="multipart/form-data"  name="form2" class="form-horizontal">      <input type="hidden"  value="<*$groups*>"  name="groupid" />
       <div class="control-group" >
        <label class="control-label" for="version_no">学生</label>
        <div class="controls"> 
           <ul class='span6'>
          <*if $result*>
          <*foreach from=$result item=a key =key name=foo*> 
             <li class='span1' style="list-style:none"> 
              <label class="radio">
      			  <input type="radio" value="<*$a.uid_student*>"  name="uid[]" >  <*$a.cnname*>
    		  </label> 
             </li>
          <*/foreach*>
          <*else*>
         <span style="color:red"> 请选择学生信息！</span>
          <*/if*>
          </ul>
        </div>
      </div> 
      
      
      <div class="control-group">
        <label class="control-label" for="version_no">反馈内容</label>
        <div class="controls">
           <input  type="text"  value=""  name="title" id="title"   placeholder="反馈问题"/>
        </div>
      </div>
      
       <div class="control-group">
        <label class="control-label" >问题类型</label>
        <div class="controls">
        <*if $result.isover==0*>
         <label class="radio inline">
       		 <input type="radio" name="optionsRadios" id="optionsRadios1" value="1"  <*if $result.type eq 1*> checked <*/if*>> bug
        </label> 
        <label class="radio inline">
       		  <input type="radio" name="optionsRadios" id="optionsRadios1" value="2"  <*if $result.type eq 2*> checked <*/if*>> 新功能
        </label>
        <label class="radio inline">
       		<input type="radio" name="optionsRadios" id="optionsRadios1" value="3"   <*if $result.type eq 3*> checked <*/if*> > 建议
        </label>
        <label class="radio inline">
       		 <input type="radio" name="optionsRadios" id="optionsRadios4" value="4"   <*if $result.type eq 4*> checked <*/if*>> 用户个案
        </label> 
         <label class="radio inline">
       		 <input type="radio" name="optionsRadios" id="optionsRadios5" value="5"  <*if $result.type eq 5*> checked <*/if*>> 忽略
        </label>  
        <*else*>
      			  <*if $result.type eq 1*> 
                   bug
       			  <*else if $result.type eq 2*> 
                  新功能
       			  <*else if $result.type eq 3*> 
                  建议
       			  <*else if $result.type eq 4*> 
                  用户个案
       			  <*else if $result.type eq 5*> 
                  忽略
                 <*/if*>
        <*/if*>   
        </div>
      </div>
       
      <*if $result.isover==0*>
      <div class="control-group">
        <label class="control-label" >处理结果</label>
        <div class="controls">
         <input type="hidden" value="<*$result.feedbackid*>" name="feedbackid" id="feedbackid"/>
          <textarea name="process" id="process" rows="10" class="span4" placeholder="答复内容"></textarea>
        </div>
      </div> 
     
      <div class="control-group">
        <label class="control-label" >问题状态</label>
        <div class="controls"> 
        <label class="radio inline">
       		  <input type="radio" name="type[]" id="type1" value="1"  <*if $result.type eq 2*> checked <*/if*>> 待处理
        </label> 
        <label class="radio inline">
       		  <input type="radio" name="type[]" id="type2" value="2"  <*if $result.type eq 2*> checked <*/if*>> 处理中
        </label> 
        <label class="radio inline">
       		 <input type="radio" name="type[]" id="type4" value="4"   <*if $result.type eq 4*> checked <*/if*>> 完成
        </label>  
        </div>
      </div>
      <*/if*>
      <div  class="control-group">
         <div id="notice">
          
         </div>      
      </div> 
      
      
      <div class="form-actions">
     <*if $result.isover==0*>
         <button class="btn btn-large  btn-success" type="button" onclick="opfeed()" >提交反馈内容</button>
         <button type="button" class="btn btn-large" onclick="window.location='/<*$controller*>/index'" >返回</button>
         <*else*>
          <button class="btn btn-large btn-block btn-success" type="button"  onclick="window.location='/<*$controller*>/index'" >返回</button>
         <*/if*> 
  
      </div>  
       
    </form>
  </div>
</div>
</small>
<script type="text/javascript" src="/js/prototype.js"></script>
<script type="text/javascript"> 

  window.onload=function(){
	 jigou(); 

	if('<*$groups*>' != ''){
		getSchool('<*$groups*>');
	}
	if('<*$school_id*>' != ''){
		getClass('<*$school_id*>');
	}

 } 
function jigou()
{  
     
	var url     = '/<*$controller*>/groups/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '';
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_course});

} 
function showResponse_course(originalRequest)
{
	{  //alert(originalRequest.responseText);  
		 document.all.form1.groups.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$groups*>' != ''){
			 jsSelectIsExitItem(document.all.form1.groups,'<*$groups*>');
	        } 
	 }

}  

function getSchool(a)
{  
	var url  = '/<*$controller*>/schoollist/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '&id=' + a;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_school});

} 
function showResponse_school(originalRequest)
{
	{    //alert(originalRequest.responseText);  
		 document.all.form1.school.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$school_id*>' != ''){
				jsSelectIsExitItem(document.all.form1.school,'<*$school_id*>');
			}
	 } 
}  
function getClass(a)
{  
     
	var url  = '/<*$controller*>/classlist/'; 
	//var pars = '&classname=' + classname +'&name=' + name+'&studentno=' + studentno +'&attend=' + attend + '&leave=' + leave + '&reason=' + reason;
	var pars = '&id=' + a;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_class});

} 
function showResponse_class(originalRequest)
{
	{    //alert(originalRequest.responseText);  
		 document.all.form1.class.innerHTML='<option value="0" >==请选择==</option>'+originalRequest.responseText;
		  if('<*$classid*>' != ''){
				jsSelectIsExitItem(document.all.form1.class,'<*$classid*>');
			}
	 } 
}  
 function jsSelectIsExitItem(objSelect, objItemValue) {
	//alert(objSelect.options.length);
    for (var i = 0; i < objSelect.options.length; i++) {
        if (objSelect.options[i].value == objItemValue) { 
			objSelect.options[i].selected=true;
        	 break;
        }
    }
    return 1;
}  
 function opfeed()
{    
    <!--问题 -->
     var content = document.getElementById('title').value;	
	  
    <!--处理结果 -->
	 var process = document.getElementById('process').value;	
	 //被选中的学生
     var uid_student  =document.getElementsByName("uid[]") ;
  
	 //问题状态   结束   未结束 
	 var question_type = document.getElementsByName('type[]');  
	 
	  var  q_type='';
	   for( i =0 ; i<question_type.length; i++ )
  		{
 			if( question_type[i].checked==true ){
 				 
 				var  q_type=question_type[i].value;
 				 
 				} 
   		}
	  
	 //问题分类  --新功能、、、
	 var  list = document.getElementsByName("optionsRadios");
     var  typelist='';
	   for( i =0 ; i<list.length; i++ )
  		{
 			if( list[i].checked==true ){
 				 
 				var  typelist=i+1;
 				 
 				} 
   		}
	 
	
	    var uid='';
		for( i =0 ; i<uid_student.length; i++ )
			{
				if( uid_student[i].checked==true ){
					//alert(uid_student[i].value);
					 
					var  uid=uid_student[i].value;
					 } 
			 }
	 
	 
	var url     = '/<*$controller*>/addop'; 
	var pars = 'content=' + content+'&process='+process+'&q_type='+q_type+'&typelist='+typelist+'&uid='+uid;
	var myAjax = new Ajax.Request( url, { method: 'post', parameters: pars, onComplete:showResponse_feedback});

}

function showResponse_feedback(originalRequest)
{
	  
	if(originalRequest.responseText =='1'){ 
	  alert('插入成功');
	  location.href='/<*$controller*>/index/type/ispend';
	}else if(originalRequest.responseText =='-1'){
	   alert('插入失败');
		return false;
	}else if(originalRequest.responseText =='-2'){
	   alert('请输入反馈的内容');
		return false;
	}else if(originalRequest.responseText =='-3'){
	   alert('请选择问题的类型');
		return false;
	}else if(originalRequest.responseText =='-4'){
	   alert('请选择问题的状态');
		return false;
	}else if(originalRequest.responseText =='-5'){
	   alert('请选择反馈的家长');
		return false;
	} 
   
}



</script> 
